<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><title>狼族少年、血狼</title><meta name="author" content="狼族少年、血狼"><meta name="copyright" content="狼族少年、血狼"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="website">
<meta property="og:title" content="狼族少年、血狼">
<meta property="og:url" content="https://geekwolfman.github.io/page/6/index.html">
<meta property="og:site_name" content="狼族少年、血狼">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png">
<meta property="article:author" content="狼族少年、血狼">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png"><link rel="shortcut icon" href="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png"><link rel="canonical" href="https://geekwolfman.github.io/page/6/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/db.json","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: true,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '狼族少年、血狼',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-06-08 14:15:24'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pace-js/themes/blue/pace-theme-minimal.min.css"/><script src="https://cdn.jsdelivr.net/npm/pace-js/pace.min.js"></script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">14</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-images"></i><span> 画廊</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-paper-plane"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/pages/01index.png')"><nav id="nav"><span id="blog-info"><a href="/" title="狼族少年、血狼"><span class="site-name">狼族少年、血狼</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-images"></i><span> 画廊</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-paper-plane"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">狼族少年、血狼</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/2023/03/24/%E9%A9%BE%E9%A9%B6%E8%AF%81%E7%A7%91%E7%9B%AE%E4%B8%80%E6%89%A3%E5%88%86%E8%A7%84%E5%88%99%E8%AE%B0%E5%BF%86%E6%8A%80%E5%B7%A7.html" title="驾驶证科目一扣分规则记忆技巧"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%20%E9%A9%BE%E9%A9%B6%E8%AF%81%E7%A7%91%E7%9B%AE%E4%B8%80%E6%89%A3%E5%88%86%E8%A7%84%E5%88%99%E8%AE%B0%E5%BF%86%E6%8A%80%E5%B7%A7/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="驾驶证科目一扣分规则记忆技巧"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/24/%E9%A9%BE%E9%A9%B6%E8%AF%81%E7%A7%91%E7%9B%AE%E4%B8%80%E6%89%A3%E5%88%86%E8%A7%84%E5%88%99%E8%AE%B0%E5%BF%86%E6%8A%80%E5%B7%A7.html" title="驾驶证科目一扣分规则记忆技巧">驾驶证科目一扣分规则记忆技巧</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-24T14:09:30.000Z" title="发表于 2023-03-24 22:09:30">2023-03-24</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-24T15:24:44.344Z" title="更新于 2023-03-24 23:24:44">2023-03-24</time></span></div><div class="content">扣分规则详情《道路交通安全违法行为记分管理办法》规定，机动车驾驶人有下列交通违法行为之一
一次记1分：

驾驶校车、中型以上载客载货汽车、危险物品运输车辆在高速公路、城市快速路以外的道路上行驶超过规定时速百分之十以上未达到百分之二十的；
驾驶机动车不按规定会车，或者在高速公路、城市快速路以外的道路上不按规定倒车、掉头的；
驾驶机动车不按规定使用灯光的；
驾驶机动车违反禁令标志、禁止标线指示的；
驾驶机动车载货长度、宽度、高度超过规定的；
驾驶载货汽车载物超过最大允许总质量未达到百分之三十的；
驾驶未按规定定期进行安全技术检验的公路客运汽车、旅游客运汽车、危险物品运输车辆以外的机动车上道路行驶的；
驾驶擅自改变已登记的结构、构造或者特征的载货汽车上道路行驶的；
驾驶机动车在道路上行驶时，机动车驾驶人未按规定系安全带的；
驾驶摩托车，不戴安全头盔的。

一次记3分：

驾驶校车、公路客运汽车、旅游客运汽车、7座以上载客汽车以外的其他载客汽车载人超过核定人数百分之二十以上未达到百分之五十的；
驾驶校车、中型以上载客载货汽车、危险物品运输车辆以外的机动车在高速公路、城市快速路以外的道路上行驶超 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/03/24/%E7%AE%80%E6%98%93%E7%89%88%E5%8D%B3%E6%97%B6%E9%80%9A%E8%AE%AF%E7%B3%BB%E7%BB%9F.html" title="简易版即时通讯系统"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E7%AE%80%E6%98%93%E7%89%88%E5%8D%B3%E6%97%B6%E9%80%9A%E8%AE%AF%E7%B3%BB%E7%BB%9F/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="简易版即时通讯系统"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/24/%E7%AE%80%E6%98%93%E7%89%88%E5%8D%B3%E6%97%B6%E9%80%9A%E8%AE%AF%E7%B3%BB%E7%BB%9F.html" title="简易版即时通讯系统">简易版即时通讯系统</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-24T13:49:54.000Z" title="发表于 2023-03-24 21:49:54">2023-03-24</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-24T14:02:22.062Z" title="更新于 2023-03-24 22:02:22">2023-03-24</time></span></div><div class="content">写在前面之前了解了即时通讯设计的基本方案，感觉蛮有意思，但一直没有实现；这两天参照网上的教程实现了一些小功能，此项目未经严格测试，仅供娱乐，切勿当真！。
技术架构主要技术：vue+springboot+mybatis-plus
网上教程是前后端不分离项目，我还是想做前后端分离的，之后可以考虑集成到其他项目中去。
交互设计数据库设计用户表：
记录用户基本信息，这里给出必要的几个字段即可

消息表：
主要用于记录用户之间发送的消息，其中包括，发送者id，接收者id，发送内容等

接口设计因为即时通讯系统需要前后端互相配合，因此接口的设计和传输对象的设计比较重要，这里给出po和vo的设计
持久化对象：

用户对象

1234567891011121314151617181920212223242526272829303132333435363738394041package com.wolfman.wolfchat.po;import com.baomidou.mybatisplus.annotation.IdType;import com.baomidou.mybatisplus.anno ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/03/23/Nacos%E9%BB%98%E8%AE%A4%E4%BD%BF%E7%94%A8%E5%86%85%E7%BD%91%E6%B3%A8%E5%86%8C%E9%97%AE%E9%A2%98.html" title="Nacos默认使用内网注册问题"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/Nacos%E9%BB%98%E8%AE%A4%E4%BD%BF%E7%94%A8%E5%86%85%E7%BD%91%E6%B3%A8%E5%86%8C%E9%97%AE%E9%A2%98/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Nacos默认使用内网注册问题"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/23/Nacos%E9%BB%98%E8%AE%A4%E4%BD%BF%E7%94%A8%E5%86%85%E7%BD%91%E6%B3%A8%E5%86%8C%E9%97%AE%E9%A2%98.html" title="Nacos默认使用内网注册问题">Nacos默认使用内网注册问题</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-23T15:52:48.000Z" title="发表于 2023-03-23 23:52:48">2023-03-23</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-23T15:59:26.723Z" title="更新于 2023-03-23 23:59:26">2023-03-23</time></span></div><div class="content">问题描述如下图所示，服务1和网关部署在服务器1上，服务2和nacos部署在服务器2上。网关调用服务1成功，调用服务2失败。报错如下：

1234567891011121314151617io.netty.channel.ConnectTimeoutException: connection timed out: /10.0.0.12:8888        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$2.run(AbstractEpollChannel.java:576) ~[netty-transport-native-epoll-4.1.59.Final-linux-x86_64.jar!/:4.1.59.Final]        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s):        |_ c ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/03/23/%E7%AE%80%E5%8D%95%E6%9D%83%E9%99%90%E7%AE%A1%E7%90%86%E6%A8%A1%E5%9E%8B%E4%BB%8B%E7%BB%8D.html" title="简单权限管理模型介绍"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E7%AE%80%E5%8D%95%E6%9D%83%E9%99%90%E7%AE%A1%E7%90%86%E6%A8%A1%E5%9E%8B%E4%BB%8B%E7%BB%8D/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="简单权限管理模型介绍"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/23/%E7%AE%80%E5%8D%95%E6%9D%83%E9%99%90%E7%AE%A1%E7%90%86%E6%A8%A1%E5%9E%8B%E4%BB%8B%E7%BB%8D.html" title="简单权限管理模型介绍">简单权限管理模型介绍</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-23T15:32:36.000Z" title="发表于 2023-03-23 23:32:36">2023-03-23</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-23T15:39:32.648Z" title="更新于 2023-03-23 23:39:32">2023-03-23</time></span></div><div class="content">前言风、宇个人博客的权限管理也是一个亮点，实现了接口管理与菜单管理，将前后端的权限都封装为可配置，此文简单总结一下基本使用。
权限管理方案基本介绍授权是用户认证通过根据用户的权限来控制用户访问资源的过程，拥有资源的访问权限则正常访问，没有
权限则拒绝访问。
基于角色RBAC基于角色的访问控制（Role-Based Access Control）是按角色进行授权，比如：主体的角色为总经理可以查询企业运营报表，查询员工工资信息等，访问控制流程如下：

根据上图中的判断逻辑，授权代码可表示如下：
123if(主体.hasRole(&quot;总经理角色id&quot;))&#123;     查询工资 &#125; 

如果上图中查询工资所需要的角色变化为总经理和部门经理，此时就需要修改判断逻辑为“判断用户的角色是否是
总经理或部门经理”，修改代码如下
123if(主体.hasRole(&quot;总经理角色id&quot;) || 主体.hasRole(&quot;部门经理角色id&quot;))&#123;     查询工资 &#125; 

我们可以发现当需要修改角色的权限时就需要修改 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/03/23/%E7%AD%96%E7%95%A5%E6%A8%A1%E5%BC%8F-%E6%A8%A1%E6%9D%BF%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F%E4%BB%8B%E7%BB%8D.html" title="策略模式+模板方法模式介绍"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E7%AD%96%E7%95%A5%E6%A8%A1%E5%BC%8F%2B%E6%A8%A1%E6%9D%BF%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F%E4%BB%8B%E7%BB%8D/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="策略模式+模板方法模式介绍"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/23/%E7%AD%96%E7%95%A5%E6%A8%A1%E5%BC%8F-%E6%A8%A1%E6%9D%BF%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F%E4%BB%8B%E7%BB%8D.html" title="策略模式+模板方法模式介绍">策略模式+模板方法模式介绍</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-23T15:29:06.000Z" title="发表于 2023-03-23 23:29:06">2023-03-23</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-23T15:41:37.537Z" title="更新于 2023-03-23 23:41:37">2023-03-23</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/">设计模式</a></span></div><div class="content">前言风、宇的个人博客中针对第三方登录、文件上传等功能使用了策略模式+模板方法模式进行编写，是非常良好的编程习惯，这样在新增策略时只需要添加新类即可，同时也避免了复杂的条件判断。
这里总结一下策略模式与模板方法模式的结合使用。

 值得提到的是，对于设计模式的学习我更偏向于结合具体的场景进行理解，以便今后灵活应用，而不是死板地记忆各种类角色。

策略模式在策略模式（Strategy Pattern）中，一个类的行为或其算法可以在运行时更改。这种类型的设计模式属于行为型模式。
例如我们要创建一个计算策略，通过传入不同的策略执行不同的逻辑：

创建一个接口

123public interface Strategy &#123;   public int doOperation(int num1, int num2);&#125;


创建实现接口的实体类，封装了具体地执行逻辑，也就是不同的策略

123456789101112131415161718public class OperationAdd implements Strategy&#123;   @Override   publi ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/2023/03/23/%E6%89%8B%E5%86%99%E7%AE%80%E6%98%93%E7%89%88spring-web%E6%A1%86%E6%9E%B6.html" title="手写简易版spring web框架"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E6%89%8B%E5%86%99%E7%AE%80%E6%98%93%E7%89%88spring-web%E6%A1%86%E6%9E%B6/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="手写简易版spring web框架"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/23/%E6%89%8B%E5%86%99%E7%AE%80%E6%98%93%E7%89%88spring-web%E6%A1%86%E6%9E%B6.html" title="手写简易版spring web框架">手写简易版spring web框架</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-23T15:06:50.000Z" title="发表于 2023-03-23 23:06:50">2023-03-23</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-23T15:23:16.383Z" title="更新于 2023-03-23 23:23:16">2023-03-23</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E6%89%8B%E5%86%99%E7%B3%BB%E5%88%97/">手写系列</a></span></div><div class="content">前言spring框架给java工程师们提供了极大的便利，只需要添加相应的配置即可快速搭建项目骨架，将更多重心放在业务逻辑的开发中。spring具有两大核心功能：

控制反转（IoC，Inversion of Control）
传统的JAVA开发模式中，当需要一个对象时，我们使用new或者通过getInstance等直接或者间接调用构造方法创建一个对象，而在spring开发模式中，spring容器使用工厂模式为我们创建了所需要的对象，不需要我们自己去创建了，直接调用spring提供的对象就可以了，这就是控制反转。控制反转的好处有：

使用方便，不用开发者大量使用new
解耦合，实例对象交给容器管理


面向切面编程（AOP）
 在面向对象编程（OOP）中，我们将事务纵向抽成一个个的对象，而在面向切面编程中，我们将一个个的对象某些类似的方面横向抽成一个切面，对这个切面进行一些如权限控制，事务管理，日志记录等公用操作处理的过程，就是面向切面编程的思想。


实现ioc主要流程图
加载类文件首先我们需要加载包下的类文件，包名我们可以手动配置，因此提供配置文件：
1234567891011121 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/2023/03/23/%E8%BF%B7%E5%AE%AB%E6%B8%B8%E6%88%8F.html" title="迷宫游戏"><img class="post-bg" src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/articles/%E8%BF%B7%E5%AE%AB%E6%B8%B8%E6%88%8F/01cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="迷宫游戏"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/03/23/%E8%BF%B7%E5%AE%AB%E6%B8%B8%E6%88%8F.html" title="迷宫游戏">迷宫游戏</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-03-23T12:32:18.000Z" title="发表于 2023-03-23 20:32:18">2023-03-23</time><span class="article-meta-separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-03-23T15:04:23.853Z" title="更新于 2023-03-23 23:04:23">2023-03-23</time></span></div><div class="content">写在前面算法设计与分析课程大作业为实现一个迷宫游戏，我觉得挺有意思的，于是做一下记录。
java的图形化编程没怎么学，我打算采用js来实现，使用网页编程的好处是比较轻量，并且自由度比较高，也挺适合这类小游戏的，但最主要的原因还是java图形化编程不太会。
前期准备首先引入jq简化开发，生成迷宫的基本思路是外面套一层div作为包裹，中间再包裹上小div，当然外层div拥有边框，内部的小div就需要对边框进行处理：

所有div加上右边和下边的边框
最后一行去除下边框
最后一列去除右边框

html结构如下：
12345678910111213141516171819202122232425262728293031323334353637383940&lt;body&gt;        &lt;div class=&quot;maze-outer&quot;&gt;            &lt;div class=&quot;first-grid&quot;&gt;                &lt;div class=&quot;second-grid&quot;&gt;&lt; ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/5/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/5/#content-inner">5</a><span class="page-number current">6</span></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://geekwolfman-blog.oss-cn-chengdu.aliyuncs.com/config/avatar/avatar.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">狼族少年、血狼</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">57</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">14</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://wpa.qq.com/msgrd?v=3&amp;uin=2370032534&amp;site=qq&amp;menu=yes&amp;jumpflag=1"><i class="fa-brands fa-qq"></i><span>添加博主QQ</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">本站所有博文均是博主的学习笔记与个人理解，来源于网络，如有<span style="color:red;font-weight:bold;">侵权</span>请<a target="_blank" rel="noopener" href="https://wpa.qq.com/msgrd?v=3&uin=2370032534&site=qq&menu=yes&jumpflag=1" style="color:#49B1F5;font-weight:bold">联系我</a>进行删除🥰。</div></div><div class="sticky_layout"><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">57</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2023-03-21T16:00:00.000Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">173k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-06-08T06:15:23.179Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 狼族少年、血狼</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"><script>window.typedJSFn = {
  init: (str) => {
    window.typed = new Typed('#subtitle', Object.assign({
      strings: str,
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50,
    }, null))
  },
  run: (subtitleType) => {
    if (true) {
      if (typeof Typed === 'function') {
        subtitleType()
      } else {
        getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
      }
    } else {
      subtitleType()
    }
  }
}
</script><script>function subtitleType () {
  fetch('https://v1.hitokoto.cn')
    .then(response => response.json())
    .then(data => {
      if (true) {
        const from = '出自 ' + data.from
        const sub = []
        sub.unshift(data.hitokoto, from)
        typedJSFn.init(sub)
      } else {
        document.getElementById('subtitle').innerHTML = data.hitokoto
      }
    })
}
typedJSFn.run(subtitleType)
</script></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="false"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></body></html>